﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using CavinatorService.DAO.Extensao;
using System.Runtime.Serialization;

namespace CavinatorService.Model
{
    /// <summary>
    /// Classe para representar uma pergunta
    /// </summary>
    [DataContract]
    public class Question : IEquatable<Question>
    {
        #region Properties

        /// <summary>
        /// Id da pergunta
        /// </summary>
        [DataMember]
        public int Id { get; set; }

        /// <summary>
        /// Pergunta
        /// </summary>
        [DataMember]
        public string Value { get; set; }

        #endregion

        #region Constructors

        public Question()
        {

        }

        public Question(IDataReader drlinha)
        {
            Id = drlinha.VerificarColuna("Id", 0);
            Value = drlinha.VerificarColuna("Value", string.Empty);
        }

        #endregion

        #region Methods

        public bool Equals(Question other)
        {
            if (other == null)
                return false;

            return other.Id == this.Id && other.Value == this.Value;
        }

        #endregion
    }
}
